<script setup lang="ts">
import { TresCanvas } from '@tresjs/core'
import { OrbitControls, TransformControls } from '@tresjs/cientos'
import { ref, shallowReactive } from 'vue'
const boxRef = ref()
const controlsState = shallowReactive({
	mode: 'translate',
	enabled: true,
})
</script>

<template>
	<TresCanvas clear-color="#202020">
		<TresPerspectiveCamera :position="[11, 11, 11]" :fov="45" :near="0.1" :far="1000" />
		<OrbitControls make-default />
		<TransformControls :object="boxRef" v-bind="transformState" :mode="controlsState.mode" />
		<TresMesh ref="boxRef" :position="[0, 4, 0]" cast-shadow>
			<TresBoxGeometry :args="[1.5, 1.5, 1.5]" />
			<TresMeshToonMaterial color="#FBB03B" />
		</TresMesh>
		<TresMesh :rotation="[-Math.PI / 2, 0, 0]" receive-shadow>
			<TresPlaneGeometry :args="[10, 10, 10, 10]" />
			<TresMeshToonMaterial />
		</TresMesh>
		<TresAmbientLight :intensity="0.5" />
		<TresDirectionalLight :position="[0, 8, 4]" :intensity="1.5" cast-shadow />
	</TresCanvas>
</template>